﻿/// <summary>
/// Developer: CHOOI KAH WAI
/// Last Modified: 16/11/2009
/// </summary>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Xml.Linq;

namespace ARSS.Common
{
    /// <summary>
    /// Animation keyframe data class
    /// </summary>
    class KeyFrame
    {
        #region Properties

        /// <summary>
        /// Time in seconds
        /// </summary>
        public double TSec { get; set; }

        /// <summary>
        /// Animating nodes
        /// </summary>
        public ArrayList Nodes { get; set; }

        #endregion

        #region Functions

        /// <summary>
        /// Constructor
        /// </summary>
        public KeyFrame()
        {
            Nodes = new ArrayList();
        }

        /// <summary>
        /// Load keyframe
        /// </summary>
        /// <param name="ele">XML element containing keyframe data</param>
        public void LoadNode(XElement ele)
        {

            TSec = double.Parse(ele.Attribute("tsec").Value);

            foreach (XElement eleNode in ele.Elements("AnimationNode"))
            {
                AnimationNode am = new AnimationNode();
                am.LoadNode(eleNode);
                Nodes.Add(am);
            }
        }

        #endregion

    }
}
